import gulp from 'gulp';
import plugins_ from 'gulp-load-plugins';
import config_ from '../taskconfig';
import del from 'del';
var plugins = plugins_();
var config = config_.scss;

gulp.task('scss:build', () => {
     return gulp.src(config.src)
        .pipe(plugins.sass())
        .pipe(plugins.autoprefixer())
        .pipe(gulp.dest(config.build))
        .pipe(plugins.concat('sc.css'))//合并
        .pipe(plugins.minifyCss())
        .pipe(plugins.rename({suffix: '.min'}))
        .pipe(gulp.dest(config.build));
});

gulp.task('scss:watch', () => {
    gulp.watch(config.all, ['scss:build']);
});

gulp.task('scss:clean', (cb) => {
    return del([config.build], cb);
});